package com.ccc.controller;

import com.ccc.entity.User;
import com.ccc.service.IUserService;
import com.ccc.utils.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@ResponseBody
public class TestController {

    @Autowired
    IUserService userService;

    /**
     * 开发时测试用的接口
     *
     * @return
     */
    @GetMapping("/user/config")
    @PreAuthorize("hasAuthority('teacher')")
    public ResponseResult<List<User>> test() {
        return new ResponseResult<List<User>>(200, "success", userService.list());
    }
}
